package com.szrt.guanchen.com.practice.day20161021.homework01;

import java.util.Scanner;

import org.junit.Test;

public class StringToInt {
	private static Scanner sc = new Scanner(System.in);
	
		
	private static String s ;
	static {
		System.out.println("输入内容");
		s = sc.next();
		sc.close();
	}
	
	@Test
	public void stringToInt(){
		
		try{
			int a = Integer.parseInt(s);
			System.out.println("没出现异常");
			System.out.println(a);
		}catch(Exception ex){
			System.out.println(ex);
			
		}
	}
	
	@Test
	public void stringToInt01() throws Exception{
		
		int a = Integer.parseInt(s);
			
	}
	
}


